﻿using Microsoft.AspNetCore.Mvc.Filters;
using NLog;

namespace Frame.Core.Attribute
{
    public class LogExceptionFilter : IExceptionFilter
    {
        public Logger logger = LogManager.GetCurrentClassLogger();
        public void OnException(ExceptionContext filterContext)
        {
            logger.Error("控制器:{0};动作方法:{1};异常信息:{2}",
                    filterContext.RouteData.Values["Controller"],
                    filterContext.RouteData.Values["Action"],
                    filterContext.Exception.Message);
        }
    }
}
